package com.qf.cosmetology.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: xiyang
 * @FileName: CrosConfig
 * @Date: Created in 2021/7/1 09:20
 * @Vserion:
 * @Description: TODO
 */
@Configuration
public class CrosConfig  implements WebMvcConfigurer {
    public static  final  String[]  METHOD= {"GET","POST","DELETE","PATCH","PUT"};
   @Override
   public void addCorsMappings(CorsRegistry registry) {
       registry.addMapping("/**")
               .allowedOriginPatterns("*")
               .allowedHeaders("*")
               .allowedMethods(METHOD)
               .allowCredentials(false)
               .maxAge(6000);
   }
}
